package design.factory.abstractFactory;

import java.util.Stack;

public class AbstractGun implements Gun {
    protected AbstractGun() {}
    protected Stack<Bullet> charger = new Stack<>(); // 弹夹
    @Override
    public void shoot() {
        Bullet b = charger.pop();
        b.beFire();
    }

    @Override
    public void loading(Bullet bullet) {
        charger.push(bullet);
        System.out.println("装弹成功");
    }
    @Override
    public int getChargeSize() {
        return this.charger.size();
    }
}
